#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    vector<int> singleNumber(vector<int>& nums) {
        int a_b = 0;
        for (int i = 0; i < nums.size(); i++) {
            a_b ^= nums[i];
        }
        int pos = 1;
        while (!(a_b & pos)) {
            pos = pos << 1;
        }
        int n1 = 0, n2 = 0;
        for (auto& e : nums) {
            if (e & pos) {
                n1 ^= e;
            }
            else {
                n2 ^= e;
            }
        }
        return vector<int>(2) = { n1, n2 };
    }
};